package InterfaceMahasiswa;

import InterfaceStaff.*;
import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

public class PresensiModelMahasiswa extends AbstractTableModel {

    private List<Mahasiswa> mhs = new ArrayList<Mahasiswa>();

    public PresensiModelMahasiswa(List<Mahasiswa> mahasiswa) {
        this.mhs = mahasiswa;
    }

    public int getRowCount() {
        return this.mhs.size();
    }

    public int getColumnCount() {
        return 3;
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
        Mahasiswa k = mhs.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return k.getNIM();
            case 1:
                return k.getNama();
            case 2:
                return k.getStatus();
            default:
                return "";
        }
    }

    @Override
    public String getColumnName(int columnIndex) {
        switch (columnIndex) {
            case 0:
                return "NIM";
            case 1:
                return "Nama";
            case 2:
                return "Status";
            default:
                return "";
        }
    }
}
